package animation;

import javax.media.j3d.Alpha;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.PositionInterpolator;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.AxisAngle4d;

import modell.DummySphere;

public class UpAndDown extends TransformGroup{
	private Alpha a = null;
	private PositionInterpolator pip = null;
	private Transform3D t = null;
	
	public UpAndDown(){
		this.a = new Alpha();
		this.a.setLoopCount(-1);
		this.a.setMode(Alpha.INCREASING_ENABLE | Alpha.DECREASING_ENABLE);
		this.a.setIncreasingAlphaDuration((long)(Math.random()*1000));
//		this.a.setIncreasingAlphaRampDuration(1);
		this.a.setDecreasingAlphaDuration((long)(Math.random()*1000));
//		this.a.setDecreasingAlphaRampDuration(1);
		this.a.setAlphaAtOneDuration((long)(Math.random()*400));
		this.a.setAlphaAtZeroDuration((long)(Math.random()*400));
		
		this.t = new Transform3D();
		this.t.set(new AxisAngle4d(0.0d, 0.0d, 1.0d, Math.PI/2));
		this.pip = new PositionInterpolator(a, this, this.t, 0.0f, 0.8f);
		this.pip.setSchedulingBounds(new BoundingSphere());
		
		this.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
		this.addChild(this.pip);
	}
	
	public Alpha getAlpha(){
		return this.a;
	}
}
